package cn.vc.content.entity.article;

import cn.vc.basicmodule.entity.Entity;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;

import java.util.List;

/**
 * 文章历史
 */
@Data
public class ArticleHistory extends Entity {
    private Long userId; // 所属用户ID
    private String articleIds; // 历史文章ID数组的JSON
    private Long articleNum; // 历史记录数量
    @TableField(exist = false)
    private List<Long> articleIdList; // 历史视频ID数组

    public void setArticleIds(String articleIds) {
        this.articleIds = articleIds;
        this.articleIdList = JSON.parseArray(articleIds, Long.class);
    }

    public void setArticleIdList(List<Long> articleIdList) {
        this.articleIdList = articleIdList;
        this.articleIds = JSON.toJSONString(articleIdList);
    }
}
